#include <stdio.h>
#include <signal.h>

volatile int flag = 0;

void handler(int sig)
{
    printf("change flag 0 to 1\n");
    flag = 1;
    printf("flag: %d\n", flag);
}

int main()
{
    signal(2, handler);
    while (!flag);

    printf("process quit\n");
    return 0;
}
